home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / pgp23src.zip / MOREPGP < prev    next >
Text File  |  1993-03-07  |  1KB  |  42 lines

  1. #!/usr/local/perl
  2.  
  3. # written by jason steiner, jsteiner@anwsun.phya.utoledo.edu, Jan 1993
  4. #
  5. # if you use or make improvements to this program i would appreciate
  6. # copies of your modifications & your PGP public key.
  7.  
  8. $|=1;
  9. $topgp=0;
  10. $logname = $ENV{'LOGNAME'};
  11. $pager='/usr/ucb/more';
  12. $pager = $ENV{'PAGER'} if ($ENV{'PAGER'});
  13. open (PAGER, "|$pager") || die "cannot open pipe to $pager\n";
  14. while (<STDIN>) {
  15.     if (!$topgp) {print PAGER;}
  16.     if (!$topgp && m/^-----BEGIN PGP .*-----/) {
  17.         $topgp = 1;
  18.         close PAGER;
  19.         $tmpfile = "/tmp/.pgp.$$.$logname";
  20.         unlink($tmpfile);
  21.         open (TMPFILE, ">$tmpfile") || die "cannot open $tmpfile for output\n";
  22.     }
  23.     if ($topgp) {
  24.         print TMPFILE $_;
  25.         if (m/^-----END PGP .*-----/) {
  26.             $topgp = 0;
  27.             close TMPFILE;
  28.             $clrfile = "/tmp/.clr.$$.$logname";
  29.             `pgp $tmpfile -o $clrfile`;
  30.             open (PAGER, "|$pager") || die "cannot open pipe to $pager\n";
  31.             open (CLEAR, "<$clrfile");
  32.                         print PAGER "-----BEGIN PGP TEXT-----\n";
  33.             while (<CLEAR>) { print PAGER; }
  34.             close CLEAR;
  35.             unlink($clrfile);
  36.             unlink($tmpfile);
  37.             print PAGER "-----END PGP TEXT-----\n";
  38.         }
  39.     }
  40. }
  41. close PAGER;
  42.